package com.example.web;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by liuhuan on 2016/11/10.
 */
@RestController
public class HelloController {
    Logger logger = LoggerFactory.getLogger(this.getClass());

    @ApiOperation(value = "helloWorld测试控制器", notes = "返回hello字符串")
    @ApiImplicitParam(name = "name", value = "用户名称", required = true, dataType = "String")
    @RequestMapping(value = "/hello/{name}", method = RequestMethod.GET)
    public String index(@PathVariable(value = "name", required = true) String name) {
        logger.info("name=" + name);
        return "Hello " + name + "!";
    }
}